package cn.lblbc.lib.download.db.dao

import androidx.room.Dao
import androidx.room.Insert
import androidx.room.Query
import androidx.room.Update
import cn.lblbc.lib.download.db.bean.DbDownloadTaskInfo

@Dao
interface DownloadDao {
    @Insert
    fun add(vararg downloadTasks: DbDownloadTaskInfo): LongArray?

    @Update
    fun update(vararg downloadTasks: DbDownloadTaskInfo)

    @Query("DELETE FROM download_task")
    fun deleteAll()

    //查询出所有数据
    @Query("SELECT * FROM download_task")
    fun query(): List<DbDownloadTaskInfo>?

    @Query("SELECT * FROM download_task where id=:id")
    fun queryById(id: String): DbDownloadTaskInfo?

    @Query("DELETE FROM download_task where id=:id")
    fun deleteById(id: String)
}